﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace aaaSoft.SkinEngine.MyControls
{
    class MyPanel : IMyControl
    {
        Panel pnlBase;
        SkinEngine skinEng;

        public MyPanel(Panel pnl,SkinEngine skinEng)
        {
            pnlBase = pnl;
            this.skinEng = skinEng;
        }

        public void StopControlSkin()
        {
            pnlBase.Paint -= new PaintEventHandler(pnlBase_Paint);
        }

        public void StartControlSkin()
        {
            pnlBase.Paint += new PaintEventHandler(pnlBase_Paint);
        }

        void pnlBase_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.FillRectangle(new SolidBrush(skinEng.BackColor), new Rectangle(new Point(0, 0), pnlBase.Size));
        }
    }
}
